var dao = require("../dao/userTelDao");
var call = require("../util/result");

async function queryList(params){

    let rows = await dao.queryList(params);
    return call.success(rows);
}

async function queryByPage(params){

    let rows = await dao.queryByPage(params);
    let total = await dao.queryCount(params);
    return call.success({rows, total});
}

async function queryById(id){

    let rows = await dao.queryById(id);
    return call.success({vo: rows.length > 0 ? rows[0]: {}});
}

async function update(id){
    await dao.update(id);
    return call.success();
}

exports.queryList = queryList;
exports.queryByPage = queryByPage;
exports.queryById = queryById;
exports.update = update;